package com.tianci.appstore;

import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.ImageView;

import com.tianci.appstore.audio.IAudio;
import com.tianci.appstore.ui.SkinManager;
import com.tianci.appstore.ui.list.ListBaseView;
import com.tianci.appstore.ui.list.bootsetting.SelectLaunchListView;

public class LaunchManageActivity extends SkyBaseActivity {
    private ImageView imageView;
    private ListBaseView contentView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        imageView = new ImageView(this);
        SkinManager.setBackground(imageView, R.drawable.ui_sdk_app_bg);
        this.setContentView(imageView);
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        if (hasFocus && contentView == null) {
            contentView = new SelectLaunchListView(this);
            setContentView(contentView);
            initAudio();
        }
        super.onWindowFocusChanged(hasFocus);
    }

    @Override
    protected void onDestroy() {
        // TODO Auto-generated method stub
        if (contentView != null) {
            contentView.destroyController();
        }
        super.onDestroy();
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        // TODO Auto-generated method stub
        if (contentView != null && contentView.processKeyDown(keyCode))
            return true;
        return super.onKeyDown(keyCode, event);
    }

    @Override
    public String getName() {
        String str = "应用圈开机启动设置";
        return str;
    }

    @Override
    public IAudio getAudioInterface() {
        return contentView.getAudioInterface();
    }
}
